<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="/web/system/admin/include :: top"></th:block>
</head>
<body class="gray-bg">

<style>
    .layui-table td {
         padding: 10px;
    }
    .layui-table td, .layui-table th {
        border-width: 0px;
        border-style: solid;
        border-color: #e6e6e6;
        border-bottom: 1px solid #e6e6e6;
        padding-left: 10px;
    }

</style>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a><cite>监控管理</cite></a>
                <a><cite>服务监控</cite></a>
            </span>
    <a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" th:onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div style="padding: 10px; background-color: #F2F2F2;">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">CPU</div>
                <div class="layui-card-body">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="150">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>属性</th>
                            <th>值</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>核心数</td>
                            <td th:text="${server.cpu.cpuNum}+'0个'"></td>
                        </tr>
                        <tr>
                            <td>用户使用率</td>
                            <td th:text="${server.cpu.used}+'%'"></td>
                        </tr>
                        <tr>
                            <td>系统使用率</td>
                            <td th:text="${server.cpu.sys}+'%'"></td>
                        </tr>
                        <tr>
                            <td>当前空闲率</td>
                            <td th:text="${server.cpu.free}+'%'"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">内存</div>
                <div class="layui-card-body">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="150">
                            <col width="150">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>属性</th>
                            <th>内存</th>
                            <th>JVM</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>总内存</td>
                            <td th:text="${server.mem.total}+'GB'"></td>
                            <td th:text="${server.jvm.total}+'MB'"></td>
                        </tr>
                        <tr>
                            <td>已用内存</td>
                            <td th:text="${server.mem.used}+'GB'"></td>
                            <td th:text="${server.jvm.used}+'MB'"></td>
                        </tr>
                        <tr>
                            <td>剩余内存</td>
                            <td th:text="${server.mem.free}+'GB'"></td>
                            <td th:text="${server.jvm.free}+'MB'"></td>
                        </tr>
                        <tr>
                            <td>使用率</td>
                            <th:block th:if="${server.mem.usage gt 80}"><td style="color: red" th:text="${server.mem.usage}+'%'"></td></th:block>
                            <th:block th:unless="${server.mem.usage gt 80}"><td th:text="${server.mem.usage}+'%'"></td></th:block>
                            <th:block th:if="${server.jvm.usage gt 80}"><td style="color: red" th:text="${server.jvm.usage}+'%'"></td></th:block>
                            <th:block th:unless="${server.jvm.usage gt 80}"><td th:text="${server.jvm.usage}+'%'"></td></th:block>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">服务器信息</div>
                <div class="layui-card-body">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="150">
                            <col width="150">
                            <col width="150">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>服务器名称</th>
                            <th>服务器IP</th>
                            <th>操作系统</th>
                            <th>系统架构</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td th:text="${server.sys.computerName}"></td>
                            <td th:text="${server.sys.osName}"></td>
                            <td th:text="${server.sys.computerIp}"></td>
                            <td th:text="${server.sys.osArch}"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">Java虚拟机信息</div>
                <div class="layui-card-body">
                    <table class="layui-table">
                        <tbody>
                        <tr>
                            <td>Java名称</td>
                            <td th:text="${server.jvm.name}"></td>
                            <td>Java版本</td>
                            <td th:text="${server.jvm.version}"></td>
                        </tr>
                        <tr>
                            <td>启动时间</td>
                            <td th:text="${server.jvm.startTime}"></td>
                            <td>运行时长</td>
                            <td th:text="${server.jvm.runTime}"></td>
                        </tr>
                        <tr>
                            <td>安装路径</td>
                            <td th:text="${server.jvm.home}"></td>
                            <td>项目路径</td>
                            <td th:text="${server.sys.userDir}"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">磁盘状态</div>
                <div class="layui-card-body">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="150">
                            <col width="150">
                            <col width="150">
                            <col width="150">
                            <col width="150">
                            <col width="150">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>盘符路径</th>
                            <th>文件系统</th>
                            <th>盘符类型</th>
                            <th>总大小</th>
                            <th>可用大小</th>
                            <th>已用大小</th>
                            <th>已用百分比</th>
                        </tr>
                        </thead>
                        <tbody>
                        <th:block th:each="sysFile,status:${server.sysFiles}">
                        <tr>
                            <td th:text="${sysFile.dirName}"></td>
                            <td th:text="${sysFile.sysTypeName}"></td>
                            <td th:text="${sysFile.typeName}"></td>
                            <td th:text="${sysFile.total}"></td>
                            <td th:text="${sysFile.free}"></td>
                            <td th:text="${sysFile.used}"></td>
                            <td th:text="${sysFile.usage}+'%'"></td>
                        </tr>
                        </th:block>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

    </div>
</div>

<th:block th:include="/web/system/admin/include :: bottom" />
</body>
</html>